package com.jjb.www.ui.adapter;

import android.content.Context;
import android.view.ViewGroup;

import androidx.annotation.NonNull;

import com.hjq.shape.view.ShapeTextView;
import com.jjb.www.R;
import com.jjb.www.app.AppAdapter;
import com.jjb.www.http.api.PlanDetitleApi;

/**
 *    author : Android CRG
 *    github : https://github.com/getActivity/AndroidProject
 *    time   : 2018/11/05
 *    desc   : 可进行拷贝的副本
 */
public final class PlanDetailsAdapter extends AppAdapter<PlanDetitleApi.Bean.PlanInfoDTO.TimeListDTO> {

    public PlanDetailsAdapter(Context context) {
        super(context);
    }


    @NonNull
    @Override
    public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        return new ViewHolder();
    }

    private final class ViewHolder extends AppAdapter<?>.ViewHolder {
        private ShapeTextView mTvNum;
        private ShapeTextView mTvTime;
        private ShapeTextView mTvType;



        private ViewHolder() {
            super(R.layout.item_plan_details);
            mTvNum = findViewById(R.id.tv_num);
            mTvTime = findViewById(R.id.tv_time);
            mTvType = findViewById(R.id.tv_type);

        }

        @Override
        public void onBindView(int position) {
            mTvNum.setText(getItem(position).getNum());
            mTvType.setText(getItem(position).getTime());
            if (getItem(position).getType()==0){
                mTvTime.setText("线上直播");
            }else {
                mTvTime.setText("线下培训");
            }
        }
    }
}